package com.ph.shopping.common.core.other.certificates.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ph.shopping.common.core.other.certificates.request.CertificatesData;
import com.ph.shopping.common.util.http.UrlRequestUtil;
/**
 * 
* @ClassName: IdCodeAuthUtil  
* @Description: 身份认证util 
* @author lijie  
* @date 2017年3月17日  
*
 */
public class IdCodeAuthUtil {
	
	private static final Logger log = LoggerFactory.getLogger(IdCodeAuthUtil.class);
			
	private static final String SUCCESS = "true";
	
	/**
	* @Title: idCertificatesAuth  
	* @Description: 身份证件请求发送  
	* @param @param data
	* @param @return
	* @param @throws Exception    参数  
	* @return boolean    返回类型  
	* @throws
	 */
	public static boolean idCertificatesAuth(CertificatesData data) throws Exception {
		StringBuilder sbud = new StringBuilder();
		sbud.append("idCard=").append(data.getIdCode())
		.append("&name=").append(data.getIdName());
		// 构造请求
		String reoponse = UrlRequestUtil.sendPost(data.getAuthUrl().trim(), sbud.toString());
		if(log.isDebugEnabled()){
			log.debug("身份认证返回值" + reoponse);
		}
		return SUCCESS.equalsIgnoreCase(reoponse);
	}
}
